//
//  SMHAccountView.swift
//  SMHCommerce
//
//  Created by lvzhao on 2020/7/21.
//  Copyright © 2020 lvzhao. All rights reserved.
//

import UIKit

class SMHAccountView: UIView {

    
    
    var textField : UITextField?
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupView()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    //MARK: 创建UI
    func setupView() {
        
        textField = UITextField.init()
        self.addSubview(textField!)
        textField?.snp.makeConstraints({ (make) in
            make.centerY.equalTo(self.snp.centerY)
            make.width.equalTo(self)
            make.height.equalTo(self)
            make.top.equalTo(0);
        })
        
        let lineView = UIView()
        lineView.backgroundColor = ColorLine
        self.addSubview(lineView)
        lineView.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.width.equalTo(self)
            make.height.equalTo(0.5)
            make.bottom.equalTo(0)
        }
        
        
        
        
    }
    
    
    //MARK: Set
    var placeholder : String?{
        didSet{
            self.textField?.placeholder = placeholder
            
            // 字体大小
            self.textField?.attributedPlaceholder = NSAttributedString.init(string:placeholder ?? "", attributes: [NSAttributedString.Key.font:UIFont.systemFont(ofSize:15),NSAttributedString.Key.foregroundColor:ColorPlacrholder])
            
            

            
        }
      
    }

    

    
    
    
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
